//
//  YCOrderStatusTableViewCell.m
//  lianganyuchu
//
//  Created by iMac on 17/2/28.
//  Copyright © 2017年 杭州桑缇电子商务有限公司. All rights reserved.
//

#import "YCOrderStatusTableViewCell.h"

@interface YCOrderStatusTableViewCell()
{
    UIButton *m_butttonDetail;
}
@end
@implementation YCOrderStatusTableViewCell

- (void)awakeFromNib {
    [super awakeFromNib];
    [self.labelStatus setFont:[UIFont LightFontOfSize:15]];
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}
-(void)bindWith:(OrderTable *)order
{
    [self.labelStatus setText:order.status_text];
    if (order.status) {
        [[App shared]readOrderColor];
        NSString *rgb1=[[App shared].dictColor objectForKey:order.status][@"status_color"];
        [self.backView setBackgroundColor:colorFromHexCode(rgb1)];
        
        NSString *rgb2=[[App shared].dictColor objectForKey:order.status][@"text_color"];
        [self.labelStatus setTextColor:colorFromHexCode(rgb2)];
    }
    
    if (m_butttonDetail==nil) {
        CGFloat width=kMainScreen_Width-30;
        m_butttonDetail=[[UIButton alloc]initWithFrame:CGRectMake(width-120-kDistance, 0, 120, 40)];
        [m_butttonDetail.titleLabel setFont:[UIFont LightFontOfSize:14]];
        [m_butttonDetail setTitle:@"查看物流详情" forState:UIControlStateNormal];
        [m_butttonDetail setImage:[UIImage imageNamed:@"arrow_rightwhite"] forState:UIControlStateNormal];
        [m_butttonDetail setImageEdgeInsets:UIEdgeInsetsMake(12, 111, 12, 0)];
        [m_butttonDetail setTitleEdgeInsets:UIEdgeInsetsMake(0, 0, 0, 14)];
        [m_butttonDetail addTarget:self action:@selector(detailBtnClicked:) forControlEvents:UIControlEventTouchUpInside];
    }
    [self.backView addSubview:m_butttonDetail];
    [m_butttonDetail setHidden:!(order.show_express.intValue==1)];
    
}
-(void)detailBtnClicked:(UIButton *)button
{
    self.expressBlock();
}
@end





